package Library.operation;

import Library.Book;
import Library.BookList;

import java.util.Scanner;

public class AddOperation implements IOperation{

    @Override
    public void work(BookList bookList) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("新增图书");
        System.out.println("请输入书名:");
        String name = scanner.next();
        System.out.println("请输入作者:");
        String author = scanner.next();
        System.out.println("请输入价格:");
        double price = scanner.nextDouble();
        System.out.println("请输入种类:");
        String type = scanner.next();
        Book book = new Book(name,author,price,type);

        int size = bookList.getSize();
        bookList.setBook(size,book);
        bookList.setSize(size + 1);
        System.out.println("新增图书完成");

    }
}
